import 'package:flutter/material.dart';
import 'package:flutter_demo/views/dialog_test.dart';
import 'package:flutter_demo/views/login/pretty_login_page.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter_demo/views/test_custom_paint.dart';
import 'package:flutter_demo/views/test_relayout_repaint.dart';
import 'package:flutter_demo/views/test_timeline.dart';
import 'package:flutter_demo/views/test_widget_size.dart';
import 'package:flutter_demo/views/verifycode/verify_code_page.dart';
import 'routers/routers.dart';
import 'routers/application.dart';
import 'utils/provider.dart';
import 'utils/shared_preferences.dart';
import 'views/app_home.dart';
import 'test/key/swap_color_1.dart';
import 'test/key/swap_color_2.dart';
import 'test/key/swap_color_3.dart';
import 'test/key/swap_color_4.dart';
import 'package:flutter_demo/views/login_two/ui/login_page_new.dart';
import 'package:flutter_demo/views/login/login_page_official.dart';

var db;
SpUtil sp;
const int ThemeColor = 0xFFC91B3A;

void main() async {
//  debugPaintSizeEnabled = true;
  final provider = Provider();
  await provider.init(true);
  sp = await SpUtil.getInstance();
  db = Provider.db;
  return runApp(MyApp());
}

class MyApp extends StatelessWidget {
  MyApp() {
    _initRouters();
  }

  ///配置routers
  void _initRouters() {
    final Router router = Router();
    Routers.configureRoutes(router);
    Application.router = router;
  }

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
          primaryColor: Color(ThemeColor),
          backgroundColor: Color(0xffefefef),
          accentColor: Color(0xff888888),
          textTheme:
              TextTheme(body1: TextStyle(color: Colors.black, fontSize: 16)),
          iconTheme: IconThemeData(color: Color(ThemeColor), size: 35.0)),
      home: Scaffold(
        appBar: null,
        //处理异性屏的控件SafeArea
        body: SafeArea(
//          child: PrettyLoginPage(),
//          child: TestWidgetSize(),
//            child: CustomPaintRoute(),
//            child: RelayoutAndRepaintTestRoute(),
//            child:DialogTest(),
          child:VerificationCodePage(),
//          child: TimelineExample(),
//          child: LoginPageOfficial(),
//          child: AppHomePage(),
//            child: SwapColorDemo1(),
//          child: SwapColorDemo2(),
//          child: SwapColorDemo3(),
//          child: SwapColorDemo4(),

//          child: LoginPageNew(),
        ),
      ),
      onGenerateRoute: Application.router.generator,
    );
  }
}
